package MyRevise;

import java.sql.*;
import java.util.ArrayList;

import Entities.MainTable;
import Enum.*;
import Db.*;

import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.TableCursor;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Label;
import Entities.*;
/**
 * Hello world!ddddffff
 *
 */
public class App 
{

	
	private static Text text_3;

	public static void main(String[] args)  {
				
		

		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setModified(true);
		shell.setSize(643, 460);
		
		shell.setText("hello world.");
		shell.setLayout(new FormLayout());
		
		Composite composite_1 = new Composite(shell, SWT.NONE);
		composite_1.setLayoutData(new FormData());
		
		TabFolder tabFolder = new TabFolder(composite_1, SWT.NONE);
		tabFolder.setLocation(0, 0);
		tabFolder.setSize(627, 424);
		
		TabItem tbtmWordsManager = new TabItem(tabFolder, SWT.NONE);
		tbtmWordsManager.setText("Words manager");
		
		Composite composite = new Composite(tabFolder, SWT.NONE);
		composite.setToolTipText("Add new word to vocabulary");
		tbtmWordsManager.setControl(composite);
		
		
		MainTable table_1 = new MainTable(composite);
		
		TableColumn tblclmnNewColumn = new TableColumn(table_1.getTable(), SWT.NONE);
		tblclmnNewColumn.setWidth(163);
		tblclmnNewColumn.setText("Word");
		
		TableColumn tblclmnNewColumn_1 = new TableColumn(table_1.getTable(), SWT.NONE);
		tblclmnNewColumn_1.setWidth(147);
		tblclmnNewColumn_1.setText("Translate");
		
		ToolBar toolBar = new ToolBar(composite, SWT.FLAT | SWT.RIGHT);
		toolBar.setBounds(10, 46, 112, 28);
		
		final WordManagerDialog wmd = new WordManagerDialog();
		
		ToolItem tltmAdd = new ToolItem(toolBar, SWT.NONE);
		tltmAdd.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				wmd.ShowDialog(shell);
			}
		});
		tltmAdd.setText("Add");
		
		ToolItem tltmEdit = new ToolItem(toolBar, SWT.NONE);
		tltmEdit.setText("Edit");
		
		ToolItem tltmDelete = new ToolItem(toolBar, SWT.NONE);
		tltmDelete.setText("Delete");
		
		TabItem tbtmRevise = new TabItem(tabFolder, SWT.NONE);
		tbtmRevise.setText("Revise");
		
		Composite composite_2 = new Composite(tabFolder, SWT.NONE);
		tbtmRevise.setControl(composite_2);
		
		text_3 = new Text(composite_2, SWT.BORDER);
		text_3.setBounds(120, 127, 258, 21);
		
		Button btnNewButton_1 = new Button(composite_2, SWT.NONE);
		btnNewButton_1.setBounds(120, 166, 75, 25);
		btnNewButton_1.setText("Check");
		
		Label lblNewLabel = new Label(composite_2, SWT.NONE);
		lblNewLabel.setBounds(120, 85, 55, 15);
		lblNewLabel.setText("Translate:");
		
		Label lblNewLabel_1 = new Label(composite_2, SWT.NONE);
		lblNewLabel_1.setBounds(120, 106, 55, 15);
		lblNewLabel_1.setText("word");
		
		Label lblResult = new Label(composite_2, SWT.NONE);
		lblResult.setBounds(405, 127, 55, 15);
		lblResult.setText("Result:");
		
		Label lblResultWord = new Label(composite_2, SWT.NONE);
		lblResultWord.setBounds(449, 127, 55, 15);
		lblResultWord.setText("Result word");
				
		try {
			Entities.MainTable.fillTable(table_1.getTable());
		} catch (SQLException e2) {
			// TODO Auto-generated catch block
			e2.printStackTrace();
		}
		
		
		shell.open();
		while (! shell.isDisposed()) {
			if (! display.readAndDispatch()) display.sleep();
		}
    }
	
	

	

	
	
}
